<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controller;

class UserController extends Controller
{

    public function store()
    {
        $admin_id = $this->container->jwt->sub->id;

        $user = new User();

        if (isset($params['username']) && isset($params['password'])) {

            $options = [
                'cost' => 12,
            ];

            $user->username = $params['username'];
            $user->assword = password_hash($params['password'], PASSWORD_DEFAULT, $options);

            try {
                $user->save();
            } catch(\Exception $e) {
                parent::log('QUERY', [$e->getMessage()]);
            }

        } else {
            return '参数缺失';
        }
    }

}
